const app = getApp();
import util from '../../../utils/util'
import {
  ImportantMemberDetail,
  AdminImportMemberDetail
} from '../../../config/api'

Page({

  /**
   * 页面的初始数据
   */
  data: {
    adminInfo:'',
    tags_id:'',
    grider_storge:'',
    familyList:[],
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    let adminInfo = wx.getStorageSync('adminInfo')
    let grider_storge = wx.getStorageSync('grider')
    this.setData({
      adminInfo,
      grider_storge,
      tags_id: options.tags_id
    })

    if (adminInfo){ // 判断管理员
      this.getAdminDrtail()
    }else{
      this.getDetail()
    }
  },

  getAdminDrtail(){ // 管理员详情
    let that = this;
    let params = {
      tags_id: that.data.tags_id,
      vollege_id: app.globalData.vollege_id,

    }
    util.apiRequest(AdminImportMemberDetail, params, null).then(r => {
      console.log('管理员人员详情：', r)
      that.setData({
        familyList: r.data.data
      })
    })
  },

  getDetail(){
    let that =this;
    let params={
      tags_id: that.data.tags_id,
      grider_id: that.data.grider_storge.id,
      vollege_id:app.globalData.vollege_id,
      
    }
    util.apiRequest(ImportantMemberDetail, params,null).then(r => {
      console.log('人员详情：',r)
      that.setData({
        familyList:r.data.data
      })
    })
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})